//
// Created by liushuai on 2021/2/6.
//

#include "maxPeakIndex.h"
int maxPeakIndex(int *a, int aLen) {
<<<<<<< HEAD:cxx/algorithm/src/maxPeakIndex.cc
    for (int i = aLen-1; i >= 0; i--) {
        if (i == aLen - 1) {
            if (a[i]>= a[i-1])
                return i;
        } else if (i == 0) {
            if (a[i] >= a[i + 1])
                return i;
        } else {
            if(a[i]>=a[i-1]&&a[i]>=a[i+1])
                return i;
        }
    }
    return -1;
}

=======
  for (int i = aLen - 1; i >= 0; i--) {
    if (i == aLen - 1) {
      if (a[i] >= a[i - 1]) return i;
    } else if (i == 0) {
      if (a[i] >= a[i + 1]) return i;
    } else {
      if (a[i] >= a[i - 1] && a[i] >= a[i + 1]) return i;
    }
  }
  return -1;
}
>>>>>>> dev:cxx/algorithm/common/src/maxPeakIndex.cc
